package com.sayimo.maker.user.service.impl;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.sayimo.framework.exception.DaoException;
import com.sayimo.framework.exception.ServiceException;
import com.sayimo.maker.user.dao.WalletIncomeExpendRecordInterfaceDao;
import com.sayimo.maker.user.service.WalletIncomeExpendRecordService;
import com.sayimo.maker.user.vo.WalletIncomeExpendRecord;

/**
 * @Copyright (c) 2015 广东省尚一互联网有限公司
 * @Project: schoolmallapi
 * @ClassName: BasePhotoServiceImpl
 * @Description: 
 * @Author:	chenpy
 * @Date:	日期：2015年12月29日  时间：上午10:43:04
 * @Version 1.0.0
 */
@Service(value = "walletIncomeExpendRecordServiceImpl")
public class WalletIncomeExpendRecordServiceImpl implements WalletIncomeExpendRecordService {
		
	private static Log logger = LogFactory.getLog(WalletIncomeExpendRecordServiceImpl.class);
	
	@Autowired
	private WalletIncomeExpendRecordInterfaceDao walletIncomeExpendRecordDao;

	public WalletIncomeExpendRecordInterfaceDao getWalletIncomeExpendRecordDao() {
		return walletIncomeExpendRecordDao;
	}

	public void setWalletIncomeExpendRecordDao(WalletIncomeExpendRecordInterfaceDao walletIncomeExpendRecordDao) {
		this.walletIncomeExpendRecordDao = walletIncomeExpendRecordDao;
	}

	public int insertSelective(WalletIncomeExpendRecord expendRecord) throws ServiceException {
		try {
			return this.walletIncomeExpendRecordDao.insertSelective(expendRecord);
		} catch (DaoException e) {
			logger.error(e);
			throw new ServiceException(e);
		}
	}

	@Override
	public Double selectRecordByMemberId(Integer memberId) throws ServiceException {
		// TODO Auto-generated method stub
		try {
			return this.walletIncomeExpendRecordDao.selectRecord(memberId);
		} catch (DaoException e) {
			logger.error(e);
			throw new ServiceException(e);
		}
	}
	
	@Override
	public List<Object> selectOrderByExpend() throws ServiceException {
		// TODO Auto-generated method stub
		try {
			return this.walletIncomeExpendRecordDao.selectOrderByExpend();
		} catch (DaoException e) {
			logger.error(e);
			throw new ServiceException(e);
		}
	}

	@Override
	public List<Object> selectOrderByIncome() throws ServiceException {
		try {
			return this.walletIncomeExpendRecordDao.selectOrderByIncome();
		} catch (DaoException e) {
			logger.error(e);
			throw new ServiceException(e);
		}
	}
}
